<?php

namespace app\common;

use think\Session;
use think\Url;

class BaseAdminController extends BaseController {
	protected $account = null;
	public function _initialize() {
		parent::_initialize ();
		// 初始化的时候检查用户是否登录
		if (! Session::has ( "certificates.isAuthc" )) {
			if ($this->request->isAjax ()) {
				header ( 'Content-Type:application/json' );
				echo '{"success": false,"msg": "未登录"}';
				exit ();
			} else {
				Session::set ( "certificates.url", $this->request->url () );
				$this->error ( '请登陆！', '/admin/login' );
			}
		} else {
			$this->account = Session::get ( 'certificates.account' );
		}
	}
}